import {createRouter, createWebHashHistory} from "vue-router"

// 定义页面路由
const routes = [
    {
        path: "/",
        component: () => import("../views/TetrisFriends.vue"),
        meta: {title: "寻找块友"}
    },
    {
        path: "/review",
        component: () => import("../views/TetrisReview.vue"),
        meta: {title: "复盘助手"}
    },
    {
        path: "/techmino",
        component: () => import("../views/Techmino.vue"),
        meta: {title: "菜就多练"}
    }
]

// 创建路由实例
const router = createRouter({
    history: createWebHashHistory(),
    routes,
})

// 路由守卫加载结束后更改页面title
router.afterEach((to) => {
    document.title = `${to.meta.title} - 打块助手`
});

// 导出实例
export default router
